<?php
class Site_Model_Observer_CopyToLocale extends Promotor_Observable_Observer_Abstract
{
	public function update(Promotor_Observable_List $list, 
								$actionType = null, $data = null, Site_Model_Site $model = null,
								Promotor_Controller_Action_Scaffold $controller = null)
	{

		if ($actionType !== 'copy')
		{
			$this->_setStatus(self::NULL);
			return;
		}

		if (!isset($data['action_checked']) || !is_array($data['action_checked']))
		{
			$this->_setStatus(self::NULL);
			return;
		}

		$urlOptions = array(
			'action' => 'copy',
			'jsonData' => Zend_Json::encode($data['action_checked']) 
		);
		
		/* @var $redirector Zend_Controller_Action_Helper_Redirector */
		$redirector = $controller->getHelper('Redirector');
		$redirector->gotoRouteAndExit($urlOptions);
	}
}
